package com.boxin.ims.modules.wechat.utils;

import java.util.ArrayList;
import java.util.List;

import com.boxin.ims.modules.wechat.entity.BusinessNewsReply;
import com.boxin.ims.modules.wechat.entity.NewsReply;
import com.thinkgem.jeesite.common.utils.StringUtils;

public class DataUtils {
	
	public static List<NewsReply> convertToNewsReplyList(List<BusinessNewsReply> businessNewsReplyList){
		List<NewsReply> newsReplyList = new ArrayList<NewsReply>();
		for(BusinessNewsReply bnr : businessNewsReplyList){
			NewsReply newsReply = new NewsReply();
			newsReply.setArticleCount(bnr.getArticleCount());
			newsReply.setCreateTime(bnr.getCreateTime());
			newsReply.setDescription(bnr.getDescription());
			newsReply.setFilePath(bnr.getFilePath());
			if(StringUtils.isEmpty(bnr.getPicUrl())){
				newsReply.setPicUrl("http://www.hdzhx.com/zxims/userfiles/business/"+bnr.getFilePath());
			}else{
				newsReply.setPicUrl(bnr.getPicUrl());
			}
			newsReply.setUrl(bnr.getUrl());
			newsReply.setTitle(bnr.getTitle());
			
			newsReplyList.add(newsReply);
		}
		
		return newsReplyList;
	}

}
